Factorize PackageDownloadRunner.TryGetRepositoriesForPackage method and add test#6953
Factorize PackageDownloadRunner.TryGetRepositoriesForPackage method and add test#6953Nigusu-Allehu merged 10 commits intodevfrom
Conversation
14ae511 to
fdc157e
Compare
|
@Nigusu-Allehu - How does this implementation differ now from the Restore code path? Any chance of refactoring into a common function? cc @nkolev92 |
Oh yes, a refactoring would definitely be nice. One question I had while looking at this: since both restore's remote walker and this command already share the core mapping logic through After that call, each path just converts source names into its own representation ( Curious what others think. happy to adjust if you see a clean way to unify those parts. |
Yeah, unfortunately any refactoring would probably add complexity, since it'd probably need to use Func or something to choose the comparer and that just adds allocations. |
|
Any tests from the restore implementation that we can copy over or viceversa? In reply to: 3554996830 |
Missing in PackageDownloadRunnerTests vs FilterDependencyProvidersForLibraryTests:
Missing in FilterDependencyProvidersForLibraryTests vs PackageDownloadRunnerTests :
|
f3999ed to
62c2dfa
Compare
I'm not seeing tests added to FilterDependencyProvidersForLibraryTests. Could you please add the appropriate tests there as well as part of this PR? |
As discussed, offline, added here instead of a separate follow up pr. |
aortiz-msft
left a comment
There was a problem hiding this comment.
Approved for now, but refactoring to be done in a separate PR.
Bug
Fixes: https://github.com/NuGet/NuGet.Client/pull/6885/files#r2487713673
Fixes: #6885 (comment)
Description
This PR Factorizes the
PackageDownloadRunner.TryGetRepositoriesForPackagemethod, to improve readability. In addition, it adds one more test scenario for the package download command: " no --source, mapping -> A&B, package in both A and B. Latest version from A installed". In addition, it also addresses a bug where http source validation was not being done for package sources when source mapping is enabled and the package is not mapped to any of the sources.PR Checklist